package image

import (
	"github.com/flipped-aurora/gin-vue-admin/server/global"
	"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
	gameReq "github.com/flipped-aurora/gin-vue-admin/server/model/game/request"
	"github.com/flipped-aurora/gin-vue-admin/server/service"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type HarborApi struct{}

var harborApiService = service.ServiceGroupApp.HarborServiceGroup.HarborService

// GetImageList 分页获取gameZone表列表
// @Tags GameZone
// @Summary 分页获取gameZone表列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query gameReq.GameZoneSearch true "分页获取gameZone表列表"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
// @Router /harbor/getImageList [get]
func (harborApi *HarborApi) GetImageList(c *gin.Context) {
	var pageInfo gameReq.GameZoneSearch
	err := c.ShouldBindQuery(&pageInfo)
	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	if list, total, err := harborApiService.GetGameZoneInfoList(pageInfo); err != nil {
		global.GVA_LOG.Error("获取失败!", zap.Error(err))
		response.FailWithMessage("获取失败", c)
	} else {
		response.OkWithDetailed(response.PageResult{
			List:     list,
			Total:    total,
			Page:     pageInfo.Page,
			PageSize: pageInfo.PageSize,
		}, "获取成功", c)
	}
}
